package com.lovesher.payment.web;


import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.alibaba.dubbo.spring.boot.annotation.EnableDubboConfiguration;
import com.lovesher.payment.service.resposity.mapper.PaymentSerialMapper;

@SpringBootApplication
@ComponentScan({ "com.business" })
@MapperScan(basePackageClasses = { PaymentSerialMapper.class })
@EnableDubboConfiguration
@EnableTransactionManagement
//@Profile("dev")
public class PayApplication extends SpringBootServletInitializer {

	private static final Logger logger = LoggerFactory.getLogger(PayApplication.class);

	public static void main(String[] args) {
		logger.info("start......");
		System.setProperty("dubbo.application.logger","slf4j");
		SpringApplication.run(PayApplication.class, args);
		
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		System.setProperty("dubbo.application.logger","slf4j");
		return application.sources(PayApplication.class);
	}

	@Bean
	public EmbeddedServletContainerCustomizer containerCustomizer() {
		return new EmbeddedServletContainerCustomizer() {
			@Override
			public void customize(ConfigurableEmbeddedServletContainer container) {
				container.setSessionTimeout(3600);// 单位为S
			}
		};
	}
}
